
begintalkscript;

variables;
int bottles, bodies;

begintalknode 10;
	state = -1;
	nextstate = -1;
	question = "Archer";
	text1 = "You make small talk with this archer for a while, but learn nothing new.";
	text2 = "They seem to be rather nervous, probably a consequence of the Hektos blasts.";
	code = 
		if(get_flag(0,25) != 4)
			remove_string(2);
	break;
begintalknode 20;
	state = -1;
	nextstate = -1;
	question = "Apprentice Mage";
	text1 = "This apprentice mage has his arms full of potent-smelling potions and herbs, and doesn't look like he's in a mood to talk. You wisely leave him alone, stifling the urge to trip him as he walks by.";

begintalknode 21;
	state = -1;
	nextstate = -1;
	question = "Apprentice Mage";
	text1 = "This apprentice is busily combining various alchemical ingredients in the cauldron in front of her. Every so often, something pops, sizzles, or smokes, making her twitch alarmingly. You decide not to bother her, lest she injure herself.";

begintalknode 40;
	state = -1;
	nextstate = 40;
	question = "Commander Ylissa";
	text1 = "This woman is dressed in some impressive chainmail, with an Empire army emblem on the shoulder. You're not sure what rank exactly, but it's something high up. Currently, she's hunched over a substantial chunk of paperwork.";
	text2 = "For a second, you get the distinct impression that there's something about her that you missed. Then you notice the huge sword sheathed at her side. The scabbard looks very worn, as does her armor. She's probably seen a lot of combat.";
	text3 = "She frowns at your entrance, then curtly addresses you. _I am Commander Ylissa, senior officer of Fort Galima. State your business or leave._";
	text5 = "Commander Ylissa looks just as unhappy as before, and she clearly wants you out of the room as quickly as possible.";
	text6 = "_Well?_";
	text7 = "Commander Ylissa looks even more frustrated than the last time you saw her. It seems that she hasn't taken the news of the Hektos blasts well, but then again, you can't fault her for that.";
	text8 = "_Speak,_ she says curtly.";
	action = INTRO;
	code = 
		if(get_flag(0,25) == 4) {
			remove_string(5);
			remove_string(6);
		}
		else {
		remove_string(7);
		remove_string(8);
	}
	break;
begintalknode 41;
	state = 40;
	nextstate = -1;
	condition = get_flag(3,4) == 0;
	question = "We're here to deliver this package. (Show it to her)";
	text1 = "She stares at it for a while, then barks out, _Take that next door, please. It's not mine to handle._";

begintalknode 42;
	state = 40;
	nextstate = -1;
	question = "What are your duties here?";
	text1 = "She glares at you and twitches. You get the distinct impression that she's looking for reasons to have you imprisoned. ";
	text2 = "_I supervise the Empire's military operations in this area. As for this fort, I designate supplies, training, and patrols. In essence, I act as drill sergeant, quartermaster, and Empire liasion._";
	text3 = "_It's very interesting work, and I'm grateful that my superiors assigned me this area,_ she says with a clearly forced smile.";
	text4 = "_And if you'll excuse me, I need to finish this._ She gestures to the pile of paperwork.";
	action = END_TALK;

begintalknode 43;
	state = 40;
	nextstate = -1;
	condition = get_flag(0,25) != 4;
	question = "Anything interesting you can tell us about this area?";
	text1 = "She laughs.";
	text2 = "_No. I do not give information to mercenaries. And if you'll excuse me, I have work to do._";
	action = END_TALK;

begintalknode 44;
	state = 40;
	nextstate = -1;
	condition = get_flag(0,25) != 4;
	question = "Do you have any jobs for us?";
	text1 = "She smirks at you for a moment before answering. _Unless you care to enlist, I have no jobs for you._";
	text2 = "You shudder at the thought of joining the army, and politely decline the commander's offer.";
	text3 = "_Well, in that case, you are of no further use to me. Consider yourself discharged from any future responsibilities at this fort._";
	text4 = "She turns her attention back to the papers littering her desk.";

begintalknode 45;
	state = 40;
	nextstate = -1;
	condition = (get_flag(0,25) == 4) && (get_flag(3,13) == 0);
	question = "What do you plan to do about Hektos?";
	text1 = "Ylissa seems to physically recoil from your question. It takes her a moment to collect herself enough to answer.";
	text2 = "_The Empire is currently not prepared to answer that question. And even if we were, I would not stoop to hiring common adventurers._";
	text3 = "She doesn't seem too sure about this last bit.";

begintalknode 46;
	state = 40;
	nextstate = -1;
	condition = (get_flag(3,13) == 0) && (get_flag(4,0) == 2);
	question = "We'd like to help you find out what happened to Hektos.";
	text1 = "Ylissa grimaces. _Right, I knew this would happen. But you couldn't leave well enough alone, could you? I didn't want to rely on mercenaries like you. But you had to ask me, and by the protocols of my position, I have no choice but to accept._";
	text2 = "_You see,_ she says with a look of utter disgust. _When a situation of this magnitude arises, I am supposed to do whatever is within my power to deal with it, using my own judgment. But if someone offers their help, whoever they may be, I must accept._";
	text3 = "_Even if the most traitorous Avernite worm offered to help investigate this occurrence, I would have to accept. Otherwise, they could report me to any Empire officer and get me incarcerated._";
	text4 = "_So, I accept your help, even though I'd love to see you thrown bodily out of this fortress right now._";
	code = 
		set_flag(3,13,1);
	break;
begintalknode 47;
	state = 40;
	nextstate = 41;
	condition = get_flag(3,13) != 0;
	question = "We'd like to talk about the investigation.";
	text1 = "_Alright,_ Ylissa says, after quickly glancing around the room. _Get on with it then._";

begintalknode 48;
	state = 40;
	nextstate = -1;
	condition = get_flag(4,20) == 1;
	question = "We'd like to formally request Empire aid for the town of Hektos, on Mayor Anderson's behalf.";
	text1 = "Ylissa snorts. _Request denied. The Empire will deal with the incident on its own timetable._";
	text2 = "Shocked, you try to change her mind, without any success. The mayor won't be pleased about this.";
	text5 = "Ylissa snorts. _You can't be serious. Not after what you've told me about the man. He can't be trusted with our supplies._";
	text6 = "Her derisive tone softens. _And as much as it pains me to say so, this means that we can't offer aid to the citizens of Hektos just yet. We must deal with this threat first._";
	code = 
		if(get_flag(3,13) < 2) {
			set_flag(4,20,2);
			remove_string(5);
			remove_string(6);
		}
		else {
		remove_string(1);
		remove_string(2);
	}
	break;
begintalknode 50;
	state = -1;
	nextstate = 50;
	question = "Sorkeli";
	text1 = "This woman is dressed in the standard garb of an Empire mage, her blue robe covered in a fairly plain-looking assortment of runes and amulets. She sways and clinks a bit as she walks, perhaps from her uneven load of charms.";
	text2 = "Despite her nearly-laughable appearance, you can sense that she's a fairly competent mage. She walks around the room with an unusually-confident gleam in her eye, seemingly undisturbed by the putrid smell which fills the room.";
	text3 = "Eventually, she notices you and waves, her armload of charms clanking madly.";
	text4 = "_Greetings, adventurers. I am Sorkeli, the official mage of Fort Galima. What brings you to my humble lab?_";
	text5 = "Sorkeli is still here, carefully watching over her apprentices. Every so often, something in a cauldron pops, and Sorkeli waves a hand and chants a short spell until the cauldron falls silent again.";
	action = INTRO;

begintalknode 51;
	state = 50;
	nextstate = -1;
	question = "What is it you do here?";
	text1 = "She smiles broadly, almost alarmingly so.";
	text2 = "_A little of this, a little of that. I'm not really at liberty to say... Empire policy. Hope you understand._";
	text3 = "You get the impression that she'd love to boast about her work if she could. Must be something fairly important.";
	text4 = "You hear something shatter in the background, and Sorkeli whips around to yell at an apprentice for a moment. Something about adding less mandrake...";
	code = 
		remove_string(4);
		if((get_flag(3,5) == 0) && (get_ran(1,1,5) == 3)) {
			add_string(4);
			set_flag(3,5,1);
		}
	break;
begintalknode 52;
	state = 50;
	nextstate = -1;
	condition = get_flag(3,6) != 2;
	question = "Any jobs you need done?";
	text1 = "Sorkeli stops to think for a moment, tapping a ring-covered finger against her forehead.";
	text2 = "_Well, if you happen to have any graymold on hand, I could really use some. Other than that, I can't think of anything._";
	code = 
		if(get_flag(3,6) == 0) {
			set_flag(3,6,1);
			toggle_quest(1,1);
		}
	break;
begintalknode 53;
	state = 50;
	nextstate = -1;
	condition = (get_flag(3,6) == 1) && (has_item(217) == 1);
	question = "Got that graymold for you.";
	text1 = "You hand Sorkeli a sprig of semi-fresh graymold, and she pops it into her mouth. Before your surprise can fully register, she begins thanking you.";
	text2 = "_Thank you so much. I don't know what I'd do without this stuff. Keeps me going all day long, and it's much better than any tea I've ever had._";
	text3 = "After chewing the herb thoughtfully for a moment, she slips one of her many rings off and hands it to you. _Anyway, take this, since I don't have any change on me right now. It's got a nifty little enchantment on it._";
	code = 
		set_flag(3,6,2);
		take_num_of_item(217,1);
		toggle_quest(1,0);
		award_party_xp(50,10);
		reward_give(273);
	break;
begintalknode 54;
	state = 50;
	nextstate = -1;
	condition = get_flag(3,6) == 2;
	question = "Got any other jobs for us?";
	text1 = "_Nope. Things are running pretty smoothly around here,_ she says with a smile.";

begintalknode 55;
	state = 50;
	nextstate = -1;
	question = "How long have you been stationed here?";
	text1 = "_Hm... it's been a few years, I think._";
	text2 = "She begins pacing around the room, clinking with an even rhythm.";
	text3 = "_I can't help but think that my superiors weren't very fond of me... particularly after I blew up Professor Fry's familiar. But then again, that rat had it coming to him, biting students like that._";
	text4 = "_Anyway, I'm here, and I can't complain. Unlike most of the others, that is. It's so peaceful, just perfect for seriously challenging experiments._";

begintalknode 56;
	state = 50;
	nextstate = -1;
	condition = get_flag(3,11) == 0;
	question = "Aren't you bothered by the smell?";
	text1 = "Sorkeli looks at you with a confused look on her face.";
	text2 = "_What smell?_";
	text3 = "Somehow, you're not surprised. You wonder how long it's been since she left the lab.";
	code = 
		set_flag(3,11,1);
	break;
begintalknode 57;
	state = 50;
	nextstate = 51;
	condition = get_flag(0,25) == 4;
	question = "What do you think of what happened in Hektos?";
	text1 = "Sorkeli's cheerful demeanor quickly fades away, to be replaced with raw anger.";
	text2 = "_I wish I could say... but the Empire has forced me to withold my opinion. I can't believe they're trying to stifle my freedom of expression!_ She continues in this vein for a while, until something catches your ear.";
	text3 = "_One of these days, they're going to push me too far, and they know what I can do to them... I've got the equipment to make them wish they were never born! What's left won't fit in a test tube!_";
	text4 = "When you ask her what she means by this, she clumsily tries to save herself.";
	text5 = "_Well, I'd never actually even consider... what I mean to say is... you can't possibly think that..._";
	text6 = "She continues to stumble over her words, never getting any clearer as to what she meant. But you're beginning to get a little suspicious of the vats scattered about the lab.";
	text7 = "Sorkeli seems to have a better grip on herself now, and her reply shows it.";
	text8 = "_I really can't say. Empire policy._";
	code = 
		if(get_flag(3,12) == 1) {
			clear_strings();
			add_string(7);
			add_string(8);
		}
		else {
		remove_string(7);
		remove_string(8);
	}
	set_flag(3,12,1);
	break;
begintalknode 58;
	state = 50;
	nextstate = -1;
	condition = get_flag(3,4) == 0;
	question = "We've got a package to deliver. (Show it to her)";
	text1 = "Sorkeli examines the package, then snatches it out of your hands and tucks it under a robed arm.";
	text2 = "_Thank you very much. This is exactly what I needed to continue my experiments._";
	text3 = "With her other arm, she reaches into her robes and pulls out a small pouch of coins. She tosses you the pouch and winks.";
	text4 = "_You're doing the Empire a great service, you know. Anyway, I'd appreciate it if you'd leave me to my work for a while, because this package changes a lot._";
	action = END_TALK;
	code = 
		set_flag(3,4,1);
		toggle_quest(0,0);
		award_party_xp(100, 10);
		change_coins(100);
		change_spec_item(0,-1);
	break;
begintalknode 70;
	state = 41;
	nextstate = -1;
	condition = (get_flag(3,13) == 1) && ((get_flag(0,21) == 1) || (get_flag(0,11) == 1) || (get_flag(4,14) != 0));
	question = "(Tell her about Mayor Anderson)";
	text1 = "You describe the mayor's erratic behavior to Ylissa, and watch her expression slowly darken.";
	text2 = "_This is news to us. We knew that the mayor disliked the Empire's presence, but it seems that we underestimated his distaste._";
	text3 = "Ylissa reaches into her desk, and withdraws a simple bronze key, which she hands to you.";
	text4 = "_This key will grant you entry to the rooms below city hall, including the mayor's private chambers. Do a bit of poking around, see what you can turn up. And try not to let him see you do it... we don't want him fleeing just yet._";
	code = 
		set_flag(3,13,2);
		change_spec_item(3,1);
		toggle_quest(11,0);
		toggle_quest(12,1);
	break;
begintalknode 71;
	state = 41;
	nextstate = -1;
	condition = (get_flag(3,13) == 1) && (get_flag(0,9) == 1) && (get_flag(3,14) == 0);
	question = "(Tell her about Will)";
	text1 = "You describe Will to the commander, and are surprised to see her smiling.";
	text2 = "_Ah, that one. We know about him. He's a rebel, alright... but not a very good one. If we wanted to, we could just barge down his door and he'd have a heart attack, and we'd be rid of him._";
	text3 = "_We listen to him, and we watch him. He's harmless. Regrettably, he also knows very little. We think he may just be a courier._";
	text4 = "_In any case, he's more valuable to us alive than dead. But thanks for trying._ Ylissa says condescendingly.";
	code = 
		set_flag(3,14,1);
	break;
begintalknode 72;
	state = 41;
	nextstate = -1;
	condition = get_flag(3,13) > 0;
	question = "What can we do to help?";
	text1 = "_Well, I'd like you to search the town of Hektos. Thoroughly. If I or any of my troops were to do it, suspicion would be aroused, and the suspect would probably flee._";
	text2 = "_So talk to everyone, and leave no stone unturned. Come back when you've found anything interesting._";
	text3 = "_I thought I'd made myself clear when I told you to search the mayor's quarters. He's our only promising lead._";
	text4 = "She sighs. _And try not to be seen, okay?_";
	text5 = "_Go speak with Private Scott at the Pearl Bridge, and find out what he's learned. That is all._";
	code = 
		if(get_flag(3,13) < 2) {
			toggle_quest(11,1);
			clear_strings();
			add_string(1);
			add_string(2);
		}
		else if(get_flag(3,13) == 2) {
		clear_strings();
		add_string(3);
		add_string(4);
	}
	else if(get_flag(3,13) == 3) {
	clear_strings();
	add_string(5);
	add_string(6);
}
	break;
begintalknode 73;
	state = 41;
	nextstate = -1;
	condition = (get_flag(5,8) != 2) && (get_flag(5,7) == 1) && (get_flag(3,13) < 3);
	question = "We didn't find anything under city hall.";
	text1 = "You detail the lack of evidence under city hall, and Ylissa starts drumming her fingers on her desk noisily.";
	text2 = "_Fine, fine, that's not important anymore. Besides, if it's that close to caving in, I don't want you down there._";
	text3 = "_While you were out at the ruins, one of my soldiers alerted me to some suspicious activity near the falls, to the east of the Pearl Bridge. He believes that the rebels may have a base of sorts in the forest._";
	text4 = "_Of course, I'm not willing to send my own troops into a nest of capably-armed rebels. I'm willing to send you, however. Go meet Private Scott at the Pearl Bridge and find out exactly what he's found._";
	code = 
		toggle_quest(12,0);
		toggle_quest(13,1);
		set_flag(3,13,3);
	break;
begintalknode 74;
	state = 41;
	nextstate = 42;
	condition = (get_flag(5,8) == 2) && (get_flag(3,13) < 3);
	question = "(Tell her what you learned from the mayor)";
	text1 = "You describe your encounter with the mayor, from its beginnning to its grisly end. Ylissa listens intently, scribbling notes down on a piece of parchment. When you reach the end of the tale, she takes a deep breath and looks you square in the eye.";
	text2 = "_I approve of your actions, but I hope you understand that nobody is to know about this. If word were to get out that the Empire assassinated one of its own leaders..._ Ylissa shudders.";
	text3 = "You describe your encounter with the mayor, and Ylissa listens intently, scribbling notes down on a piece of parchment. When you reach the end of the tale, she takes a deep breath and looks you square in the eye. She looks shocked beyond belief.";
	text4 = "_I can't understand why you would have done this... you let a traitor slip out of our grasp. I don't care what else he said, he deserved to die. And you let him go... you will tell no one of this. Not a single soul._";
	text5 = "However, when you present her with the mayor's journal, her expression brightens. She quickly flips through it. _Of course! This will be enough evidence to defend what's happened here. The bureaucrats won't be able to touch us._";
	code = 
		if(get_flag(10,9) == 1) {
			remove_string(3);
			remove_string(4);
		}
		else if(get_flag(10,9) == 2) {
		remove_string(1);
		remove_string(2);
	}
	change_spec_item(4,-1);
	toggle_quest(12,0);
	toggle_quest(13,1);
	set_flag(3,13,3);
	break;
begintalknode 75;
	state = 42;
	nextstate = -1;
	question = "So what now?";
	text1 = "She takes a deep breath. _Well, while you were at the ruins, one of my soldiers reported some suspicious activity up by the Pearl Bridge, and we believe that it's the rebels._";
	text2 = "_The mayor was clearly just a pawn. Granted, he was a pawn who did his job, but we're after the king now. I want you to go down to the Pearl Bridge and find Private Scott. He'll tell you what he's found, and then you can investigate it._";
	text3 = "You ask why she hasn't sent in her troops yet, and she smiles grimly. _I don't want my soldiers getting ambushed by rebels who are clearly well-armed. You, on the other hand, are disposable to me. You have your orders, now go._";